﻿using System;
using System.Collections.Generic;
using System.Web.UI.WebControls;

using UI.WebControls.ControlsBase;
using BLL.Common;
using Model.Common;
namespace UI.WebControls
{
    /// <summary>
    /// UI层，页面控件基类，省份下拉
    /// </summary>
    public class ProvinceDDL : DropDownListBase
    {
        /// <summary>
        /// 设置显示全部还是包含信息的
        /// </summary>
        public bool ShowAll = true;

        /// <summary>
        /// 重写加载事件
        /// </summary>
        /// <param name="e"></param>
        protected override void OnLoad(EventArgs e)
        {
            base.Items.Add(new ListItem("=选择省份=", "0"));
            IList<ProvinceInfo> list = ShowAll ? new ProvinceBLL().GetAllProvince() : new ProvinceBLL().GetInfoProvince();
            foreach (ProvinceInfo info in list)
                base.Items.Add(new ListItem(info.ProvinceName, info.ProvinceID.ToString()));
            base.OnLoad(e);
        }
    }
}
